home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / share / perl5 / Mail / Mailer / testfile.pm < prev   
Encoding:
Text File  |  2008-07-29  |  1.1 KB  |  55 lines

  1. # Copyrights 1995-2008 by Mark Overmeer <perl@overmeer.net>.
  2. #  For other contributors see ChangeLog.
  3. # See the manual pages for details on the licensing terms.
  4. # Pod stripped from pm file by OODoc 1.05.
  5. use strict;
  6.  
  7. package Mail::Mailer::testfile;
  8. use vars '$VERSION';
  9. $VERSION = '2.04';
  10.  
  11. use base 'Mail::Mailer::rfc822';
  12.  
  13. use Mail::Util qw/mailaddress/;
  14.  
  15. my $num = 0;
  16. sub can_cc() { 0 }
  17.  
  18. sub exec($$$)
  19. {   my ($self, $exe, $args, $to) = @_;
  20.  
  21.     my $outfn = $Mail::Mailer::testfile::config{outfile} || 'mailer.testfile';
  22.     open F, '>>', $outfn
  23.         or die "Cannot append message to testfile $outfn: $!";
  24.  
  25.     print F "\n===\ntest ", ++$num, " ", (scalar localtime),
  26.             "\nfrom: " . mailaddress(),
  27.             "\nto: " . join(' ',@{$to}), "\n\n";
  28.     close F;
  29.  
  30.     untie *$self if tied *$self;
  31.     tie *$self, 'Mail::Mailer::testfile::pipe', $self;
  32.     $self;
  33. }
  34.  
  35. sub close { 1 }
  36.  
  37. package Mail::Mailer::testfile::pipe;
  38. use vars '$VERSION';
  39. $VERSION = '2.04';
  40.  
  41.  
  42. sub TIEHANDLE
  43. {   my ($class, $self) = @_;
  44.     bless \$self, $class;
  45. }
  46.  
  47. sub PRINT
  48. {   my $self = shift;
  49.     open F, '>>', $Mail::Mailer::testfile::config{outfile};
  50.     print F @_;
  51.     close F;
  52. }
  53.  
  54. 1;
  55.